<!DOCTYPE html>
<html>

<head>
    <title>{$article.post_title}</title>
    <meta name="keywords" content="{$site_info.site_seo_keywords|default=''}" />
    <meta name="description" content="{$site_info.site_seo_description|default=''}">
    <include file="public@head" />
    <style>
        #article_content img {
            height: auto !important;
            max-width: 100%;
        }

        #article_content {
            word-wrap: break-word;
        }
        .layui-upload-img {
        width: 45%;
        margin: 0 10px 10px 0;
    }
    </style>
    <hook name="before_head_end" />
    <link rel="stylesheet" href="__TMPL__/public/assets/layui/css/layui.css">
    <script src="__TMPL__/public/assets/layui/layui.js?3"></script>
</head>

<body>

<div class="hd_xx">
    <a href="javascript:history.go(-1)" class="back">
        <img src="__TMPL__/public/assets/yanglao/images/i_6.png" alt="">
    </a>
    <h3>{$article.gdstatus}</h3>
    <!-- <a href="{:cmf_url('user/Index/logout')}" class="hd_dian">
        <img src="__TMPL__/public/assets/yanglao/images/i_5.png" alt="">
    </a> -->
</div>
<div class="xx_con">
    <form class="js-ajax-form" enctype="multipart/form-data" method="post" accept-charset="utf-8">
        <div class="xx_div">
            <p>
                <label>工单编号：</label>
                <span>{$article.post_source}</span>
            </p>
            <p>
                <label>姓名：</label>
                <input type="hidden" id="auth_img12" value="{$article.id}" name="article[id]" />
                <span>{$article.post_title}</span>
            </p>
            <p>
                <label>姓别：</label>
                <span>{$article.more.sex|default=''}</span>
            </p>
            <p>
                <label>年龄：</label>
                <span>{$article.more.age|default=''}</span>
            </p>
            <p>
                <label>地址：</label>
                <span>{$article.more.add|default=''}</span>
            </p>
            <p>
                <label>联系方式：</label>
                <span>{$article.more.tel|default=''}</span>
            </p>
        </div>
        <div class="xx_div">
            <table style="width: 100%;">
                <tr>
                    <td style="width: 25%;line-height:1rem;text-align: center;">服务类型：</td>
                    <td style="line-height:0.6rem;">
                        <input class="form-control" type="hidden" style="width:400px;" required value="{$article.more.xm}" placeholder="请选择项目"
                            id="js-categories-xm-input" name="article[more][xm]" readonly />
                            <div id="js-xm" name="article[more][xm]"></div>
                        </td>
                </tr>
                <tr>
                    <td style="width: 25%;line-height:1rem;text-align: center;">服务时间：</td>
                    <td style="line-height:0.6rem;">{$article.more.gdstarttime|default=''}</td>
                </tr>
                <tr>
                    <td style="width: 25%;line-height:1rem;text-align: center;">服务要求：</td>
                    <td style="line-height:0.6rem;">{$article.post_excerpt|default=''}</td>
                </tr>
            </table>
          
        </div>
    <if condition="$article.gdstatus == '待审核' or $article.gdstatus == '已完成' or $article.gdstatus == '已退款' ">
        <div class="xx_div">
            <p>
                <label>服务备注：</label>
                <span>{$article.fwymore.fwbeizhu}</span>
            </p>
            <p style="height:auto;">
                <label>服务照片：</label>
                <span>
                    <foreach name="article.fwimg" item="vo">
                        <if condition="$vo != '' "><img style="width: 100%;" src="../../storage/{$vo}" /></if>
                        
                    </foreach></span>
            </p>
           
        </div>
    </if>
    <if condition="$article.gdstatus == '待服务' ">
        <div class="xx_div">

            <textarea value="请输入定单完成结果" class="xx_nr" name="article[fwbeizhu]"></textarea>
            <input type="hidden" name="article[fwimg]"  id="fwimg"/>
            <div class="layui-upload">
                <button type="button" class="layui-btn" id="test2">多图片上传</button>
                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                    预览图：
                    <div class="layui-upload-list" id="demo2"></div>
                </blockquote>
            </div>
        </div>
    </if>        
        <div class="tijiao">
            <if condition="$article.gdstatus == '待接单' ">
                <a class="btn btn-xs ok js-ajax-delete"
                    href="{:url('portal/Article/changestatus',array('id'=>$article['id'],'gdstatus'=>'待服务'))}" data-msg="确定接单吗？">接单</a>
                
                <a href="{:url('portal/Article/changestatus',array('id'=>$article['id'],'gdstatus'=>'已拒单'))}" data-msg="确定拒单吗？"
                    class="cancel js-ajax-delete">拒单</a>
            </if>
            <if condition="$article.gdstatus == '待服务' ">
                <button type="submit" class="ok js-ajax-submit" data-msg="确定提交吗？" data-action="{:url('portal/Article/gdeditPost')}">提交</button>
                <a href="{:url('user/Profile/center')}"
                    class="cancel">取消</a>
            </if>
            
        </div>
    </form>

</div>



    <include file="public@scripts" />
    <hook name="before_body_end" />
</body>
<script src="__TMPL__/public/assets/simpleboot3/cropper/cropper.js"></script>
<script src="__TMPL__/public/assets/simpleboot3/cropper/jquery-cropper.min.js"></script>
<script src="__TMPL__/public/assets/simpleboot3/canvas-to-blob/canvas-to-blob.min.js"></script>
<script type="text/javascript">
    $(function () {

        var xmarrs = $('#js-categories-xm-input').val();
        xmarrs = JSON.parse(xmarrs);
        xmlist = xmarrs.xmarr.join('<br>');
        zje = xmarrs.zjje;
        console.log(xmlist);
        $('#js-xm').html(xmlist+'<br>'+zje);

    });
    var imgarr = [];
    layui.use('upload', function () {
            var $ = layui.jquery, 
            upload = layui.upload;
            //多图片上传
            upload.render({
                elem: '#test2'
                , url: '/portal/article/uploads' //改成您自己的上传接口
                , multiple: true
                , accept:'image/*'
                , field:'image'
                , before: function (obj) {
                    console.log(obj);
                    //预读本地文件示例，不支持ie8
                    obj.preview(function (index, file, result) {
                        $('#demo2').append('<div><img src="' + result + '" alt="' + file.name + '" class="layui-upload-img"><span>×</span></div>')
                    });
                }
                , done: function (res) {
                    //上传完毕
                    if(!res.msg.includes('topic/'))
                    {
                        alert(res.msg)
                    }
                    console.log(res);
                    imgarr.push(res.msg);
                    $('#fwimg').val(imgarr.join(';'));
                    console.log(imgarr);
                    console.log($('#fwimg').val());
                }
            });

          

        });
    
        $("#demo2").on('click', 'div span', function () {
            console.log($($(this).parent()));
            var divs = $(this).parent();
            var divsi = divs.index();
            imgarr.splice(divsi,1);
            console.log(divsi);
            $('#fwimg').val(imgarr.join(';'));
            console.log(imgarr);
            console.log($('#fwimg').val());
            divs.remove();
        });

</script>

</html>